//
//  LzwBniEndCollectCell.m
//  CoJellyCartoon
//
//  Created by 刘志武 on 16/4/1.
//  Copyright © 2016年 CJG. All rights reserved.
//

#import "LzwBniEndCollectCell.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>

@interface LzwBniEndCollectCell ()

@property (nonatomic, strong) UIImageView *myimageView;
@property (nonatomic, strong) UILabel *lableTitle;
@property (nonatomic, strong) UILabel *lableContent;


@end


@implementation LzwBniEndCollectCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        [self creatSubViews];
    }
    
    return self;
}

- (void)creatSubViews{
    
    self.myimageView = [[UIImageView alloc]init];
    self.myimageView.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.myimageView];
    
    self.lableTitle = [[UILabel alloc]init];
//    self.lableTitle.backgroundColor = [UIColor redColor];
    self.lableTitle.font = [UIFont systemFontOfSize:15];
    self.lableTitle.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.lableTitle];
    
    self.lableContent = [[UILabel alloc]init];
//    self.lableContent.backgroundColor = [UIColor purpleColor];
    self.lableContent.textColor = [UIColor lightGrayColor];

    [self.contentView addSubview:self.lableContent];
    self.lableTitle.font = [UIFont systemFontOfSize:15];
    [self.myimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.contentView.mas_centerX);
        make.top.equalTo(self.contentView).offset(0);
        make.width.equalTo(self.contentView.mas_width);
        make.height.equalTo(@140);
        
    }];
    
    [self.lableTitle mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.myimageView.mas_bottom).offset(0);
        make.width.equalTo(self.myimageView.mas_width);
        make.height.equalTo(self.lableContent.mas_height);
//        make.bottom.equalTo(self.lableContent.mas_top).offset(-10);
        make.left.equalTo(self.contentView);
        
    }];
    
    [self.lableContent mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.lableTitle.mas_bottom).offset(5);
        make.left.equalTo(self.lableTitle);
        make.width.equalTo(self.lableTitle);
        make.height.mas_equalTo(20);

        
    }];
    
    
    
}

-(void)setModelEnd:(LzwLatesModel *)modelEnd{
    
    
    _modelEnd = modelEnd;
    
    
    NSURL *url = [NSURL URLWithString:_modelEnd.cover];
    [self.myimageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiye"]];
    
    self.lableTitle.text = _modelEnd.title;
    
    NSString *str  = @"话全";
    
    NSString *str1 = _modelEnd.newest_ep_index;
    
    self.lableContent.text = [str1 stringByAppendingString:str];
    
}



@end
